Optimal. Leaf size=375 \[ -\frac{\sqrt{2} (c+d) \cos (e+f x) \left (a c d (n+3)-b \left (2 c^2-d^2 (n+2)\right )\right ) (c+d \sin (e+f x))^n \left (\frac{c+d \sin (e+f x)}{c+d}\right )^{-n} F_1\left (\frac{1}{2};\frac{1}{2},-n-1;\frac{3}{2};\frac{1}{2} (1-\sin (e+f x)),\frac{d (1-\sin (e+f x))}{c+d}\right )}{d^3 f (n+2) (n+3) \sqrt{\sin (e+f x)+1}}-\frac{\sqrt{2} \left (c^2-d^2\right ) \cos (e+f x) (2 b c-a d (n+3)) (c+d \sin (e+f x))^n \left (\frac{c+d \sin (e+f x)}{c+d}\right )^{-n} F_1\left (\frac{1}{2};\frac{1}{2},-n;\frac{3}{2};\frac{1}{2} (1-\sin (e+f x)),\frac{d (1-\sin (e+f x))}{c+d}\right )}{d^3 f (n+2) (n+3) \sqrt{\sin (e+f x)+1}}-\frac{\cos (e+f x) (2 b c-a d (n+3)) (c+d \sin (e+f x))^{n+1}}{d^2 f (n+2) (n+3)}+\frac{b \sin (e+f x) \cos (e+f x) (c+d \sin (e+f x))^{n+1}}{d f (n+3)} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.635151, antiderivative size = 373, normalized size of antiderivative = 0.99, number of steps used = 10, number of rules used = 7, integrand size = 31, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.226, Rules used = {2922, 3034, 3023, 2756, 2665, 139, 138} \[ \frac{\sqrt{2} (c+d) \cos (e+f x) \left (-a c d (n+3)+2 b c^2-b d^2 (n+2)\right ) (c+d \sin (e+f x))^n \left (\frac{c+d \sin (e+f x)}{c+d}\right )^{-n} F_1\left (\frac{1}{2};\frac{1}{2},-n-1;\frac{3}{2};\frac{1}{2} (1-\sin (e+f x)),\frac{d (1-\sin (e+f x))}{c+d}\right )}{d^3 f (n+2) (n+3) \sqrt{\sin (e+f x)+1}}-\frac{\sqrt{2} \left (c^2-d^2\right ) \cos (e+f x) (2 b c-a d (n+3)) (c+d \sin (e+f x))^n \left (\frac{c+d \sin (e+f x)}{c+d}\right )^{-n} F_1\left (\frac{1}{2};\frac{1}{2},-n;\frac{3}{2};\frac{1}{2} (1-\sin (e+f x)),\frac{d (1-\sin (e+f x))}{c+d}\right )}{d^3 f (n+2) (n+3) \sqrt{\sin (e+f x)+1}}-\frac{\cos (e+f x) (2 b c-a d (n+3)) (c+d \sin (e+f x))^{n+1}}{d^2 f (n+2) (n+3)}+\frac{b \sin (e+f x) \cos (e+f x) (c+d \sin (e+f x))^{n+1}}{d f (n+3)} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 2922
Rule 3034
Rule 3023
Rule 2756
Rule 2665
Rule 139
Rule 138
Rubi steps
\begin{align*} \int \cos ^2(e+f x) (a+b \sin (e+f x)) (c+d \sin (e+f x))^n \, dx &=\int (a+b \sin (e+f x)) (c+d \sin (e+f x))^n \left (1-\sin ^2(e+f x)\right ) \, dx\\ &=\frac{b \cos (e+f x) \sin (e+f x) (c+d \sin (e+f x))^{1+n}}{d f (3+n)}+\frac{\int (c+d \sin (e+f x))^n \left (-b c+a d (3+n)+b d \sin (e+f x)+(2 b c-a d (3+n)) \sin ^2(e+f x)\right ) \, dx}{d (3+n)}\\ &=-\frac{(2 b c-a d (3+n)) \cos (e+f x) (c+d \sin (e+f x))^{1+n}}{d^2 f (2+n) (3+n)}+\frac{b \cos (e+f x) \sin (e+f x) (c+d \sin (e+f x))^{1+n}}{d f (3+n)}+\frac{\int (c+d \sin (e+f x))^n \left (d (b c n+a d (3+n))-\left (2 b c^2-b d^2 (2+n)-a c d (3+n)\right ) \sin (e+f x)\right ) \, dx}{d^2 (2+n) (3+n)}\\ &=-\frac{(2 b c-a d (3+n)) \cos (e+f x) (c+d \sin (e+f x))^{1+n}}{d^2 f (2+n) (3+n)}+\frac{b \cos (e+f x) \sin (e+f x) (c+d \sin (e+f x))^{1+n}}{d f (3+n)}+\frac{\left (\left (c^2-d^2\right ) (2 b c-a d (3+n))\right ) \int (c+d \sin (e+f x))^n \, dx}{d^3 (2+n) (3+n)}-\frac{\left (2 b c^2-b d^2 (2+n)-a c d (3+n)\right ) \int (c+d \sin (e+f x))^{1+n} \, dx}{d^3 (2+n) (3+n)}\\ &=-\frac{(2 b c-a d (3+n)) \cos (e+f x) (c+d \sin (e+f x))^{1+n}}{d^2 f (2+n) (3+n)}+\frac{b \cos (e+f x) \sin (e+f x) (c+d \sin (e+f x))^{1+n}}{d f (3+n)}+\frac{\left (\left (c^2-d^2\right ) (2 b c-a d (3+n)) \cos (e+f x)\right ) \operatorname{Subst}\left (\int \frac{(c+d x)^n}{\sqrt{1-x} \sqrt{1+x}} \, dx,x,\sin (e+f x)\right )}{d^3 f (2+n) (3+n) \sqrt{1-\sin (e+f x)} \sqrt{1+\sin (e+f x)}}-\frac{\left (\left (2 b c^2-b d^2 (2+n)-a c d (3+n)\right ) \cos (e+f x)\right ) \operatorname{Subst}\left (\int \frac{(c+d x)^{1+n}}{\sqrt{1-x} \sqrt{1+x}} \, dx,x,\sin (e+f x)\right )}{d^3 f (2+n) (3+n) \sqrt{1-\sin (e+f x)} \sqrt{1+\sin (e+f x)}}\\ &=-\frac{(2 b c-a d (3+n)) \cos (e+f x) (c+d \sin (e+f x))^{1+n}}{d^2 f (2+n) (3+n)}+\frac{b \cos (e+f x) \sin (e+f x) (c+d \sin (e+f x))^{1+n}}{d f (3+n)}+\frac{\left (\left (c^2-d^2\right ) (2 b c-a d (3+n)) \cos (e+f x) (c+d \sin (e+f x))^n \left (-\frac{c+d \sin (e+f x)}{-c-d}\right )^{-n}\right ) \operatorname{Subst}\left (\int \frac{\left (-\frac{c}{-c-d}-\frac{d x}{-c-d}\right )^n}{\sqrt{1-x} \sqrt{1+x}} \, dx,x,\sin (e+f x)\right )}{d^3 f (2+n) (3+n) \sqrt{1-\sin (e+f x)} \sqrt{1+\sin (e+f x)}}+\frac{\left ((-c-d) \left (2 b c^2-b d^2 (2+n)-a c d (3+n)\right ) \cos (e+f x) (c+d \sin (e+f x))^n \left (-\frac{c+d \sin (e+f x)}{-c-d}\right )^{-n}\right ) \operatorname{Subst}\left (\int \frac{\left (-\frac{c}{-c-d}-\frac{d x}{-c-d}\right )^{1+n}}{\sqrt{1-x} \sqrt{1+x}} \, dx,x,\sin (e+f x)\right )}{d^3 f (2+n) (3+n) \sqrt{1-\sin (e+f x)} \sqrt{1+\sin (e+f x)}}\\ &=-\frac{(2 b c-a d (3+n)) \cos (e+f x) (c+d \sin (e+f x))^{1+n}}{d^2 f (2+n) (3+n)}+\frac{b \cos (e+f x) \sin (e+f x) (c+d \sin (e+f x))^{1+n}}{d f (3+n)}+\frac{\sqrt{2} (c+d) \left (2 b c^2-b d^2 (2+n)-a c d (3+n)\right ) F_1\left (\frac{1}{2};\frac{1}{2},-1-n;\frac{3}{2};\frac{1}{2} (1-\sin (e+f x)),\frac{d (1-\sin (e+f x))}{c+d}\right ) \cos (e+f x) (c+d \sin (e+f x))^n \left (\frac{c+d \sin (e+f x)}{c+d}\right )^{-n}}{d^3 f (2+n) (3+n) \sqrt{1+\sin (e+f x)}}-\frac{\sqrt{2} \left (c^2-d^2\right ) (2 b c-a d (3+n)) F_1\left (\frac{1}{2};\frac{1}{2},-n;\frac{3}{2};\frac{1}{2} (1-\sin (e+f x)),\frac{d (1-\sin (e+f x))}{c+d}\right ) \cos (e+f x) (c+d \sin (e+f x))^n \left (\frac{c+d \sin (e+f x)}{c+d}\right )^{-n}}{d^3 f (2+n) (3+n) \sqrt{1+\sin (e+f x)}}\\ \end{align*}
Mathematica [F] time = 3.30566, size = 0, normalized size = 0. \[ \int \cos ^2(e+f x) (a+b \sin (e+f x)) (c+d \sin (e+f x))^n \, dx \]
Verification is Not applicable to the result.
[In]
[Out]
________________________________________________________________________________________
Maple [F] time = 0.368, size = 0, normalized size = 0. \begin{align*} \int \left ( \cos \left ( fx+e \right ) \right ) ^{2} \left ( a+b\sin \left ( fx+e \right ) \right ) \left ( c+d\sin \left ( fx+e \right ) \right ) ^{n}\, dx \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F] time = 0., size = 0, normalized size = 0. \begin{align*} \int{\left (b \sin \left (f x + e\right ) + a\right )}{\left (d \sin \left (f x + e\right ) + c\right )}^{n} \cos \left (f x + e\right )^{2}\,{d x} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F] time = 0., size = 0, normalized size = 0. \begin{align*}{\rm integral}\left ({\left (b \cos \left (f x + e\right )^{2} \sin \left (f x + e\right ) + a \cos \left (f x + e\right )^{2}\right )}{\left (d \sin \left (f x + e\right ) + c\right )}^{n}, x\right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F] time = 0., size = 0, normalized size = 0. \begin{align*} \int{\left (b \sin \left (f x + e\right ) + a\right )}{\left (d \sin \left (f x + e\right ) + c\right )}^{n} \cos \left (f x + e\right )^{2}\,{d x} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]